home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gp_unifn.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.1 KB  |  56 lines

  1. /* Copyright (C) 1994, 1996 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gp_unifn.c,v 1.2 2000/09/19 19:00:25 lpd Exp $ */
  20. /* Unix-like file name syntax platform routines for Ghostscript */
  21. #include "gx.h"
  22. #include "gp.h"
  23.  
  24. /* Define the character used for separating file names in a list. */
  25. const char gp_file_name_list_separator = ':';
  26.  
  27. /* Define the string to be concatenated with the file mode */
  28. /* for opening files without end-of-line conversion. */
  29. const char gp_fmode_binary_suffix[] = "";
  30.  
  31. /* Define the file modes for binary reading or writing. */
  32. const char gp_fmode_rb[] = "r";
  33. const char gp_fmode_wb[] = "w";
  34.  
  35. /* Answer whether a file name contains a directory/device specification, */
  36. /* i.e. is absolute (not directory- or device-relative). */
  37. bool
  38. gp_file_name_is_absolute(const char *fname, unsigned len)
  39. {                /* A file name is absolute if it starts with a 0 or more .s */
  40.     /* followed by a /. */
  41.     while (len && *fname == '.')
  42.     ++fname, --len;
  43.     return (len && *fname == '/');
  44. }
  45.  
  46. /* Answer the string to be used for combining a directory/device prefix */
  47. /* with a base file name.  The file name is known to not be absolute. */
  48. const char *
  49. gp_file_name_concat_string(const char *prefix, unsigned plen,
  50.                const char *fname, unsigned len)
  51. {
  52.     if (plen > 0 && prefix[plen - 1] == '/')
  53.     return "";
  54.     return "/";
  55. }
  56.